import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/Layout.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: Layout,
      redirect:'/user',
      children: [
        {
          name:'user',
          path: 'user',
          component: () => import('@/views/User.vue')
        },
        {
          name:'book',
          path: 'book',
          component: () => import('@/views/Book.vue')
        },
        {
          name:'person',
          path: 'person',
          component: () => import('@/views/Person.vue')
        },
        {
          name:'news',
          path: 'news',
          component: () => import('@/views/News.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/Login.vue')
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('@/views/Register.vue')
    }

  ]
})

export default router
